import Cookies from "js-cookie";

const TokenKey: string = "Admin-Token";

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token: string, hours: number = 24) {
  const expires = new Date(Date.now() + hours * 60 * 60 * 1000);
  return Cookies.set(TokenKey, token, { expires });
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}
